<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="bean.ConnectMySql,java.sql.*,java.lang.*,bean.selectPrice" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>shop</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/font.css">
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.js"></script>
</head>
<body>
	<%
	response.setCharacterEncoding("UTF-8");
	response.setContentType("text/html;charset=UTF-8");
	String user=(String)session.getAttribute("user");
	String pwd=(String)session.getAttribute("pwd");
	String userId=(String)session.getAttribute("xxx");
	int id=Integer.valueOf(userId);
	PreparedStatement st=null;
	ResultSet rs = null;
	Connection con=ConnectMySql.getConnection();
	request.setCharacterEncoding("UTF-8");
		try {
  		request.setCharacterEncoding("UTF-8");
	%>
    <!-- 头部开始 -->
    <header>
        <div class="header-content">
            <!-- left start -->
            <div class="logo" style="margin-top:14px;">
                甜甜甜
            </div>
            <!-- left end -->
            <!-- center start -->
            <div class="center">
                <div class="search">
                    <form action="" method="GET" action="">
                        <input type="text" placeholder="TIANPING" name="">
                        <button class="icon-search"></button>
                    </form>
                </div>
                <div class="menu">
                    <ul>
                        <li><a href="login.jsp">首页</a></li>
                        <li><a href="shop.jsp">商品购买</a></li>
                        <li><a href="#">线下活动</a></li>
                        <li><a href="submitPage.jsp">订单</a></li>
                    </ul>
                </div>
            </div>
            <!-- center end -->
            <!-- right start -->
            <div class="right" style="width:200px;">
                <div class="user" style="display:flex;margin:14px auto 0;">
                <%
               		request.setCharacterEncoding("UTF-8");
                	if(pwd!=null && pwd.length()!=0 && user!=null && user.length()!=0){
                %>
                <div style="color:white;font-size:22px;text-align:center;margin-left:100px"><%=user%></div>
                <%
                	}
            	%>		

                </div>
                <div class="cart" style="margin-top:20px;">
                    <a href="cart.jsp"><i class="icon-bag" style="background:#735a4f;"></i></a>
                    <div class="price">
                        &yen;
                        <%
                       	    out.print(selectPrice.select(id));
                        %>
                    </div>
                   <div class="num">
                   		<%
                      		out.print(selectPrice.num(id));
                        %>
                   </div>
                    <!-- right end -->
                </div>
            </div>
    </header>

    <!-- 头部结束 -->
    

    <!-- 甜品推荐 -->
    <div class="newProduct" >
        <div class="top">
            <div class="title" style="margin-top:80px;">
                甜品
            </div>
        </div>
        <div class="content">
        <%
          		st=con.prepareStatement("select * from dish where catatoryId=1");
         		rs=st.executeQuery();
         		 while(rs.next()){
    	%>
    
            <div class="item">
                <img src="<%=rs.getString(6) %>" alt="">
                <div style="margin-top:15px;font-size:16px;font-weight:bold;'"><%=rs.getString(2) %></div>
                <div>￥<%=rs.getDouble(3) %></div>
                <form action="addCart" method="POST">
                	 <input type="hidden" name="dishId" value="<%=rs.getInt(1)%>"/>
               		 <button type="submit" class="icomoon icon-cart cart" style="border:none;background-color:#9c7157;"></button>
                </form>
            </div>
        <%           
          }
	    %>
        </div>
    </div>
    <!-- 甜品推荐结束 -->
    
	
    <!-- 咖啡推荐 -->
    <div class="newProduct" >
        <div class="top">
            <div class="title">
                咖啡
            </div>
        </div>
        <div class="content">
        <%
          		st=con.prepareStatement("select * from dish where catatoryId=2");
         		rs=st.executeQuery();
         		 while(rs.next()){
    	%>
           <div class="item">
                <img src="<%=rs.getString(6) %>" alt="">
                <div style="margin-top:15px;font-size:16px;font-weight:bold;'"><%=rs.getString(2) %></div>
                <div>￥<%=rs.getDouble(3) %></div>
                <form action="addCart" method="POST">
                	 <input type="hidden" name="cartId" value="<%=rs.getInt(1)%>"/>
               		 <button type="submit" class="icomoon icon-cart cart" style="border:none;background-color:#9c7157;"></button>
                </form>
            </div>
         <%} %>
        </div>
    </div>
    <!-- 咖啡推荐结束 -->

	<!-- 饮品推荐 -->
    <div class="newProduct" >
        <div class="top">
            <div class="title">
                饮品
            </div>
        </div>
        <div class="content">
            <%
          		st=con.prepareStatement("select * from dish where catatoryId=3");
         		rs=st.executeQuery();
         		 while(rs.next()){
    	%>
           <div class="item">
                <img src="<%=rs.getString(6) %>" alt="">
                <div style="margin-top:15px;font-size:16px;font-weight:bold;'"><%=rs.getString(2) %></div>
                <div>￥<%=rs.getDouble(3) %></div>
                <form action="addCart" method="POST">
                	 <input type="hidden" name="cartId" value="<%=rs.getInt(1)%>"/>
               		 <button type="submit" class="icomoon icon-cart cart" style="border:none;background-color:#9c7157;"></button>
                </form>
            </div>
         <%} %>
        </div>
    </div>
    <!-- 饮品推荐结束 -->
	
	<!-- 冰淇淋推荐 -->
    <div class="newProduct" >
        <div class="top">
            <div class="title">
                冰淇淋球
            </div>
        </div>
        <div class="content">
            <%
          		st=con.prepareStatement("select * from dish where catatoryId=4");
         		rs=st.executeQuery();
         		 while(rs.next()){
    		%>
            <div class="item">
                <img src="<%=rs.getString(6) %>" alt="">
                <div style="margin-top:15px;font-size:16px;font-weight:bold;'"><%=rs.getString(2) %></div>
                <div>￥<%=rs.getDouble(3) %></div>
                <form action="addCart" method="POST">
                	 <input type="hidden" name="cartId" value="<%=rs.getInt(1)%>"/>
               		 <button type="submit" class="icomoon icon-cart cart" style="border:none;background-color:#9c7157;"></button>
                </form>
            </div>
         <%} %>
        </div>
    </div>
    <!-- 冰淇淋推荐结束 -->
  	<%
	    ConnectMySql.closeResultSet(rs);
        ConnectMySql.closeStatement(st);
		  ConnectMySql.closeConnection(con);
		}catch(SQLException e) {
			e.printStackTrace();
		}
	%>
    <!-- 底部开始 -->
    <footer>
        <div class="foot">
            <div class="content">
                <dl>
                    <dt>甜甜甜VIP</dt>
                    <dd><a href="#">甜甜甜会员中心</a></dd>
                    <dd><a href="#">常见问题</a></dd>
                </dl>
                <dl>
                    <dt>配送方式</dt>
                    <dd><a href="#">配送时间</a></dd>
                    <dd><a href="#">配送范围</a></dd>
                    <dd><a href="#">配送收费方式</a></dd>
                </dl>
                <dl>
                    <dt>支付方式</dt>
                    <dd><a href="#">微信支付</a></dd>
                    <dd><a href="#">支付宝支付</a></dd>
                    <dd><a href="#">优惠券使用</a></dd>
                    <dd><a href="#">礼品券使用</a></dd>
                </dl>
                <dl>
                    <dt>售后服务</dt>
                    <dd><a href="#">退换货流程及退款</a></dd>
                    <dd><a href="#">订单修改及发票</a></dd>
                    <dd><a href="#">客服联系方式</a></dd>
                    <dd><a href="#">订购说明</a></dd>
                </dl>
            </div>

            <div class="worktime">
                任何问题，联系在线客服。工作时间：周一至周五9:00-21:00：周六，周日：10:00-18:00，法定节假日休息
            </div>
        </div>

    </footer>
    <div class="copyright">
        &copy; copyrights TTT. ALL rights researved 2024.
    </div>
    <!-- 底部结束-->

</body>

</html>